package com.lagou.mall.esflow.core.config;

import java.util.concurrent.RejectedExecutionHandler;
import java.util.concurrent.ThreadPoolExecutor;
import lombok.extern.slf4j.Slf4j;


/**
 * Date: 2021/5/23
 * <p>
 * Description: 任务拒绝策略
 *
 */
@Slf4j
public class TaskDiscardPolicy implements RejectedExecutionHandler {

    @Override
    public void rejectedExecution(Runnable r, ThreadPoolExecutor executor) {
        log.error("runnable:{},completedTaskCount:{},activeCount:{},taskCount:{}",
                r.toString(),
                executor.getCompletedTaskCount(),
                executor.getActiveCount(),
                executor.getTaskCount());
    }
}